-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Sobolev smoothing method to the discrete adjoint gradient calculation. #1446
Add a Sobolev smoothing method to the discrete adjoint gradient calculation. #1446
Conversation
…nt treatement. - Solver works on mesh and design parameter level. - Can smooth the discrete adjoint gradient. - Support for printing the combined system matrix (Laplace-Beltrami operator). - Squashed old commits into new branch based on version 7.2.1 develop.
… Sobolev smoothing solver.
Changed regression tests accordingly.
… Eigen as a submodule.
Removed config option SENS_SMOOTHING, since it is not used and reworked testcase configs. CGradientSmoothingSolver now uses the output precision from config OUTPUT_PRECISION.
- Added the necessary solver, numerics, and variable classes there. - The method is called as an alternative parallel to SetProject_AD.
…dient smoothing to SU2_DOT. - Changed regressions tests for the Sobolev smoothing solver.
Hi Pedro, |
…THING map. Cleaned up the switch statemnet for choosing a linear solver in CSysSolve. Extended documentation in the smoothing solver TestCases.
…now build using the static su2_cfd libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice feature.
This has quite a few changes so I'll have to review it in chunks.
First batch of comments below.
Thanks for the comments 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second chunk, the new solver is neatly organized 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok got to the bottom :)
Hi Pedro, |
Create a common template CFEASolverBase for solvers using the internal finite elements.
- Adding a common CFeaSolverBase class for finite elements solvers. - making functions private and variables constant in CGradientSmoothingSolver. - reworked the storage of boundary vertices in CSobolevSmoothingVariable.
45422ce
to
608cfb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patience, I think we are down to final checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok after this last batch LGTM, good simplification in SU2_DOT 👍
Have you tried a multizone case, even if it's just the NACA0012 duplicated?
Thanks for reviewing all of the code Pedro 👍 Regarding your question about multizone: |
Apply clang format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👍 LGTM
@thomasdick @pcarruscag Please leave this open until Saturday 6pm German time. I want to take a look at this as well :) Dont expect any major requested changes from me but I hope to find a few spots to nag about :D Edit: Forget this 👆 , I will scroll over this in silence at some point. But already thanks @thomasdick for the effort and the contribution :) |
Added the reference files for file diff and merged with the latest development branch. |
Proposed Changes
The proposed solver is a treatment of the discrete adjoint sensitivities based on the idea of Sobolev gradient smoothing.
Sobolev smoothing of gradients computes a reinterpretation of the gradient in a different Hilbert space, see this short overview.
This is done by solving an elliptic PDE with the sensitivities, i.e., ( e1 Id - e2 Laplace) delta_x = - dF / dx, with different weights e1, e2. Inserting the sensitivities from the discrete adjoint solver for (dF / dx) leads to the gradient in a Sobolev space.
The method can be extended to incorporate the parameterization of the mesh cells x=M(p) with design values p, see here. Using the projected gradient w.r.t. the design values the systems takes the form
(dM/dp)^T (e1 Id - e2 Laplace) (dM/dp) = - dF/dp.
Such treatment can help prevent noise in the derivative computation and leads to smoother design updates. Especially, when working in a One-Shot optimization context.
Here the optimization is done with inexact function values and gradients, i.e., the flow and adjoint solvers are only partially converged between design updates. For this setting simple gradient descent with too large update steps will not work, since a few flow iterations are not enough to recover a solution from the restart file from the last optimization step.
See the graphic below for drag minimization of a NACA 0012 airfoil with constant lift, where the Sobolev solver for the gradient leads to smoother deformations and better optimization.
Application is done as a post-processing step in the SU2_DOT_AD executable.
The new solver constructs the necessary operator and solves it using the features of the finite element implementation in SU2. For this, it uses the same elements as the FEA solver but extends the definitions of the Gauss quadrature to be second order.
It can operate in two different modes:
The smoothing can be applied to the mesh sensitivities, either in the complete mesh or only design boundaries. See the picture below for an example of this.
It also includes the possibility to take the mesh parameterization into account, compute the derivatives (dM/dp), and smooth the sensitivities w.r.t. the design parameters. This is done by the same AD logic used in SU2_DOT.cpp::SetProjection_AD. The routines are extended, such that AD can compute arbitrary matrix-vector products with the Jacobian of the parameterization and apply the smoothing operator to the gradient.
This is a continuation of draft #1439 with a new rebased branch. It has a cleaner commit history and not so much legacy from previous versions.
The regression tests for this pull request need the files for the accompanying pull request su2code/TestCases/pull/88.
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.